<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMemberVipsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('member_vips', function (Blueprint $table) {
            $table->id();
            $table->integer('member_id')->default(0)->comment('会员ID');
            $table->integer('vip')->default(0)->comment('vip 级别');
            $table->timestamp('started_at')->comment('开始时间');
            $table->timestamp('ended_at')->comment('结束时间');
            $table->timestamps();
            $table->index('vip');
            $table->index('member_id');
        });
        DB::statement("ALTER TABLE `member_vips` comment '会员VIP表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('member_vips');
    }
}
